const express=require('express');
//创建路由器对象
const router=express.Router();
const pool=require('../pool.js');

router.get('/carousel',(req,res,next)=>{
    let obj=req.query;
    console.log(obj);
    pool.query('select * from mx_carousel',(err,result)=>{
        if (err)
        {
            next(err);
            return;
        }
        console.log(result);
        //判断是否查到
        if (result.length==0)
        {
            res.send({code:200,msg:'查询失败'});
        }else{
            res.send({code:201,msg:'查询成功',data:result});
        };
    });
})

module.exports=router;